% TEST_ID: LANG-EXPAND-0015
% CATEGORY: language/array-ops/expand
% 测试 double 数组的扩展行为

function test_double_expand
    % create a empty double array
    C = [];

    % expand double array to [0, 0, 3]
    C(3) = 3;
    assert(isequal(C, [0, 0, 3]));

    % expand double array to [0 0 3 0; 0 0 0 4]
    C(2, 4) = 4;
    assert(isequal(C, [0 0 3 0; 0 0 0 4]));

    x = [];
    x(1, 1, :) = 1:3;
    assert(isequal(size(x), [1, 1, 3]));

    x = [];
    x(:, :) = reshape(1:27, 3, 9);
    assert(isequal(size(x), [3, 9]));

    x = [];
    x(:, 1, :) = reshape(1:27, 3, 9);
    assert(isequal(size(x), [3, 1, 9]));
end